<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="WUKONG 1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>花果山</title>
<link href="./themes/default/css/style_hgs.css" rel="stylesheet" type="text/css" />
<link href="./themes/default/css/users.css" rel="stylesheet" type="text/css" />

<?php echo $this->smarty_insert_scripts(array('files'=>'jquery-1.7.1.min.js,jquery.json.js,transport.js,hgsstyle.js,hgscommon.js')); ?>
</head>

<body> 

<div class="main">
	<div class="dw_head"></div>
	<div class="dw_nav" name="dw_nav" id="dw_nav"></div> 
	<div class="mainbg" name="MainName">

    	<?php echo $this->fetch('library/page_header.lbi'); ?>
		
        <div class="product"> 
            <div class="users_url">
            	<a href="/">首页</a>>企业购买
            </div>
           <div class="qiyegoumai_img_one"><a class="qiyegoumai_a" href="http://huaguoshan.com/category.php?id=6"></a></div>
            <div class="users_main">
            	<div class="yeqi_title">服务流程</div>
                <div class="qiye_liuchengtu"><img src="themes/default/images/ces-s.jpg" /></div>
            </div>
			
			
			<form method="post" name="form1" id="dx_form" autocomplete="off">
            <div class="qiyegoumai_main">
            	<div class="qiyegoumai_tishi">如果您是批量采购商品，请如实填写以下信息，我们会第一时间与您联系</div>
                <div class="qiyegoumai_input_main">
                	<div class="qiyegoumai_input_left">联系人</div>
                    <div class="qiyegoumai_input_right"><input type="text" name="username"  id="dx_username" maxlength="10" maxlength="20"/></div>
                    
                	<div class="qiyegoumai_input_left">手机号码</div>
                    <div class="qiyegoumai_input_right">
                    
                        <div class="caigou_mobile">
                            <input type="text" name="phone"  id="dx_phone" maxlength="11" onkeyup="value=value.replace(/[^0-9]/g,'');"/>
                        </div>
                        <span style="color:#ababab; padding:0px 5px;">或</span>  
                        <span style="color:#3f3f3f; padding-right:5px;">固定电话</span>
                        <div class="caigou_phone_quhao"><input type="text" value="0755" readonly="true"/></div>
                        <span style="color:#3f3f3f;">-</span>
                        <div class="caigou_phone_num"><input type="text" name="tel"  id="dx_tel" maxlength="15"  onkeyup="value=value.replace(/[^0-9\-]/g,'');"/></div>
                    </div>
                    
                    
                	<div class="qiyegoumai_input_left">公司名称</div>
                    <div class="qiyegoumai_input_right_pay"><input type="text" name="company_name"  id="dx_company_name" maxlength="50" /></div>
                    
                    <div class="caigouxuqiu">
                    	<div class="caigouxuqiu_name">采购需求</div>
                        <div class="caigouxuqiu_input"><textarea name="buying_demand" id="dx_buying_demand" onpropertychange="checkLength(this,200);" oninput="checkLength(this,200);" ></textarea></div>
                    </div>
                    
                	<div class="qiyegoumai_input_left">输入验证码</div>
                    <div class="qiyegoumai_input_right_yanzheng">
                    
                    <div class="yanzheng_kuang"><input type="text" name="code" id="dx_code"/></div>
                    <div class="login_yanzheng_right">	
                    	<div class="login_yanzheng_right_img"><img src="captcha.php?is_login=1&<?php echo $this->_var['rand']; ?>" id="image_cy" onclick="this.src='captcha.php?is_login=1&'+Math.random()"/></div>
                        <div class="login_yanzheng_right_txt"><a href="javascript:;" onclick="document.getElementById('image_cy').src = 'captcha.php?is_login=1&'+Math.random();return false;">看不清楚</a></div></div>
                    </div>
                    <div class="yanzhengkuangjia" id="error_show"></div>
                    <div class="qiyegoumai_btn" id="user_submit"></div>
                </div>
            </div>
			</form>
<script type="text/javascript">
		function checkLength(obj,maxlength)     //限制textarea字数
		{
			if(obj.value.length > maxlength)
			{        
				obj.value = obj.value.substring(0,maxlength);    
			}
		}
		$("#user_submit").bind('click', function(){
			var username = $("#dx_username").val();
			var phone = $("#dx_phone").val();
			var iphone = $("#dx_phone").val().length;
			var tel = $("#dx_tel").val();
			var itel = $("#dx_tel").val().length;
			var company_name = $("#dx_company_name").val();
			var buying_demand = $("#dx_buying_demand").val();
			var code = $("#dx_code").val();
			
			if(username == ""){
				$("#error_show").html("请输入您的姓名");
				$("#dx_username").focus();
				return false;
			}
			
			var reg0=/^13\d{5,9}$/; //130--139。至少7位
			var reg1=/^15\d{5,9}$/; //15至少7位
			var reg2=/^18\d{5,9}$/; //18
			var my=false;
			if (reg0.test(phone))my=true;    //js test()方法  phone变量文本框的值
			if (reg1.test(phone))my=true;
			if (reg2.test(phone))my=true;
			
			if(iphone!=11 && itel<=6){
				$("#error_show").html("联系方式错误");
				return false;
			}
			if (!my){
				if(itel<=6){
					$("#error_show").html("请填写您的联系方式");
					return false;
				}
			}
			
			if(company_name == ""){
				$("#error_show").html("请输入公司名称");
				$("#dx_company_name").focus();
				return false;
			}
			
			if(buying_demand == ""){
				$("#error_show").html("请输入购买需求");
				$("#dx_buying_demand").focus();
				return false;
			}
			
				$.ajax({
					type:"POST",
					cache:"false",
					url:"company_model.php",
					//data:$("#dx_form").serialize(),
					data: "username="+username + "&phone="+phone + "&tel="+tel + "&company_name="+company_name + "&buying_demand="+buying_demand + "&code="+code,
					dataType:'text',
					success:function(data)
					{
						if(data=="success"){
							$('#dx_form')[0].reset();
							$("#error_show").html("");
							$("#tips_big_div").show();
							$("#tips_word").html("提交成功，我们会尽快联系您。");
							$("#image_cy").click();
						}
						if(data=="error"){
							$("#error_show").html("验证码错误");
							$("#image_cy").click();
						}
					},
					error:function()
					{
						$("#tips_big_div").show();
						$("#tips_word").html("提交失败,请重新提交。");
					}
				})
		});
</script>
			
        </div>
	</div>
        
        
        
         

   
</div>

<div></div>
<?php echo $this->fetch('library/page_footer.lbi'); ?>
</body>

</html>


